#ifndef ANGLEGRIDITEM_H
#define ANGLEGRIDITEM_H


#include <QWidget>
#include <QPaintEvent>
#include <QFont>
#include <QPointF>


#include "ProtactorToolView.h"

namespace kepen {
namespace core {

class AngleGridItem: public QWidget
{
    Q_OBJECT
public:
    AngleGridItem(QWidget *parent,ProtactorToolView *parentContext,const int *IdArray);
    ~AngleGridItem();
    bool eventFilter(QObject *watched, QEvent *event) override;
protected:
    void leaveEvent(QEvent *) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void paintEvent(QPaintEvent *) override;

private:

    int getIdOfTouched(const QPointF &point);
    void onPaintButtons(QPainter *painter);

    void drawPartSegmentPre(QPainter* painter,int x,int y, quint32 boolFlag);
    void drawPartSegmentSub(QPainter* painter,int x,int y, quint32 boolFlag);

    void drawSvgArrow(QPainter* painter,int x,int y, quint32 boolFlag);
private:

    ProtactorToolView *editContext;
    bool isMouseLeftDown,isWindowDeactivate;
    int  m_nIdTouchedDown,m_nIdMouseOver,m_nLengthMenu;
    int idMenuArray[3];
    int cellWidthArr[3];
    QPointF ptDown;
};


}
}
#endif // ANGLEGRIDITEM_H
